home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / mint / shells / tcsh6033.zoo / tcsh-603.pl3 / complete.tcsh < prev    next >
Text File  |  1993-03-12  |  8KB  |  220 lines

  1. #
  2. # $Id: complete.tcsh,v 1.15 1992/10/10 18:17:34 christos Exp $
  3. # example file using the new completion code
  4. #
  5.  
  6. if ($?tcsh) then
  7.     if ($tcsh != 1) then
  8.        set rev=$tcsh:r
  9.     set rel=$rev:e
  10.     set pat=$tcsh:e
  11.     set rev=$rev:r
  12.     endif
  13.     if ($rev > 5 && $rel > 1) then
  14.     set complete=1
  15.     endif
  16.     unset rev rel pat
  17. endif
  18.  
  19. if ($?complete) then
  20.     set noglob
  21.     set hosts=(hyperion.ee.cornell.edu phaeton.ee.cornell.edu \
  22.            guillemin.ee.cornell.edu theory.tc.cornell.edu \
  23.            vangogh.cs.berkeley.edu)
  24.  
  25.     complete rsh    n/*/\$hosts/    # argument from list in $hosts
  26.     complete ywho      n/*/\$hosts/
  27.     complete cd      p/1/d/        # Directories only
  28.     complete chdir     p/1/d/
  29.     complete pushd     p/1/d/
  30.     complete popd     p/1/d/
  31.     complete pu     p/1/d/
  32.     complete po     p/1/d/
  33.     complete mkdir     p/1/d/
  34.     complete rmdir     p/1/d/
  35.     complete man     p/1/c/        # only commands
  36.     complete complete     p/1/C/
  37.     complete uncomplete p/1/C/
  38.     complete exec     p/1/c/
  39.     complete trace     p/1/c/
  40.     complete strace     p/1/c/
  41.     complete which     p/1/c/
  42.     complete where     p/1/c/
  43.     complete skill     p/1/c/
  44.     complete dde    p/1/c/ 
  45.     complete adb    p/1/c/ 
  46.     complete sdb    p/1/c/
  47.     complete dbx    p/1/c/
  48.     complete xdb    p/1/c/
  49.     complete gdb    p/1/c/
  50.     complete ups    p/1/c/
  51.     complete set    'c/*=/f/' 'p/1/s/=' 'n/=/f/'
  52.     complete unset    p/1/s/
  53.     complete setenv     p/1/e/        # only environment variables 
  54.     complete unsetenv     p/1/e/
  55.     complete alias     p/1/a/        # only aliases are valid
  56.     complete unalias     p/1/a/
  57.     complete xdvi     n/*/f:*.dvi/    # Only files that match *.dvi
  58.     complete dvips     n/*/f:*.dvi/
  59.     complete latex     n/*/f:*.tex/
  60.     complete tex     n/*/f:*.tex/
  61.     complete rlogin     c/-/"(l 8 e)"/ n/-l/u/ n/*/\$hosts/ 
  62.     complete telnet     n/*/\$hosts/ 
  63.     complete su        c/-/"(f)"/ n/*/u/
  64.     complete xrsh       c/-/"(l 8 e)"/ n/-l/u/ n/*/\$hosts/ 
  65.     complete cc     c/-I/d/ c/-L/d/ c/-/"(o l c g L I D U)"/ \
  66.             n/*/f:*.[coa]/
  67.     complete acc     c/-I/d/ c/-L/d/ c/-/"(o l c g L I D U)"/ \
  68.             n/*/f:*.[coa]/
  69.     complete gcc     c/-I/d/ c/-L/d/ \
  70.              c/-f/"(caller-saves cse-follow-jumps delayed-branch \
  71.                        elide-constructors expensive-optimizations \
  72.                    float-store force-addr force-mem inline \
  73.                    inline-functions keep-inline-functions \
  74.                    memoize-lookups no-default-inline \
  75.                    no-defer-pop no-function-cse omit-frame-pointer \
  76.                    rerun-cse-after-loop schedule-insns \
  77.                    schedule-insns2 strength-reduce \
  78.                    thread-jumps unroll-all-loops \
  79.                    unroll-loops syntax-only all-virtual \
  80.                    cond-mismatch dollars-in-identifiers \
  81.                    enum-int-equiv no-asm no-builtin \
  82.                    no-strict-prototype signed-bitfields \
  83.                    signed-char this-is-variable unsigned-bitfields \
  84.                    unsigned-char writable-strings call-saved-reg \
  85.                    call-used-reg fixed-reg no-common \
  86.                    no-gnu-binutils nonnull-objects \
  87.                    pcc-struct-return pic PIC shared-data \
  88.                    short-enums short-double volatile)"/ \
  89.              c/-W/"(all aggregate-return cast-align cast-qual \
  90.                          comment conversion enum-clash error format \
  91.                          id-clash-len implicit missing-prototypes \
  92.                          no-parentheses pointer-arith return-type shadow \
  93.                          strict-prototypes switch uninitialized unused \
  94.                          write-strings)"/ \
  95.              c/-m/"(68000 68020 68881 bitfield fpa nobitfield rtd \
  96.                    short c68000 c68020 soft-float g gnu unix fpu \
  97.                    no-epilogue)"/ \
  98.              c/-d/"(D M N)"/ \
  99.              c/-/"(f W vspec v vpath ansi traditional \
  100.                   traditional-cpp trigraphs pedantic x o l c g L \
  101.                   I D U O O2 C E H B b V M MD MM i dynamic \
  102.                   nodtdlib static nostdinc undef)"/ \
  103.              c/-l/f:*.a/ \
  104.              n/*/f:*.{c,C,cc,o,a}/
  105.     complete g++     n/*/f:*.{C,cc,o}/
  106.     complete CC     n/*/f:*.{C,cc,o}/
  107.     complete rm     n/*/f:^*.{c,cc,C,h,in}/    # Protect precious files
  108.     complete vi     n/*/f:^*.o/
  109.     complete bindkey    N/-a/b/ N/-c/c/ n/-[ascr]/'x:<key-sequence>'/ \
  110.             n/-[svedl]/n/ c/-[vedl]/n/ c/-/"(a s k c v e d l r)"/ \
  111.             n/-k/"(left right up down)"/ p/2-/b/ \
  112.             p/1/'x:<key-sequence or option>'/
  113.  
  114.     complete find     n/-fstype/"(nfs 4.2)"/ n/-name/f/ \
  115.               n/-type/"(c b d f p l s)"/ n/-user/u/ n/-exec/c/ \
  116.               n/-ok/c/ n/-cpio/f/ n/-ncpio/f/ n/-newer/f/ \
  117.               c/-/"(fstype name perm prune type user nouser \
  118.                    group nogroup size inum atime mtime ctime exec \
  119.                  ok print ls cpio ncpio newer xdev depth)"/ \
  120.             n/*/d/
  121.  
  122.     complete kill    c/-/S/ c/%/j/
  123.     complete -%*    c/%/j/            # fill in the jobs builtin
  124.     complete fg        c/%/j/
  125.     complete bg        c/%/j/
  126.     complete stop    c/%/j/
  127.  
  128.     complete limit    c/-/"(h)"/ n/*/l/
  129.     complete unlimit    c/-/"(h)"/ n/*/l/
  130.  
  131.     complete -co*    p/0/"(compress)"/    # make compress completion
  132.                         # not ambiguous
  133.     complete zcat    n/*/f:*.Z/
  134.     complete nm        n/*/f:^*.{h,C,c,cc}/
  135.  
  136.     complete finger    c/*@/\$hosts/ p/1/u/@ 
  137.     complete ping    p/1/\$hosts/
  138.     complete traceroute    p/1/\$hosts/
  139.  
  140.     complete talk    p/1/'`users | tr " " "\012" | uniq`'/ \
  141.         n/*/\`who\ \|\ grep\ \$:1\ \|\ awk\ \'\{\ print\ \$2\ \}\'\`/
  142.  
  143.     if ( -f $HOME/.netrc ) then
  144.     complete ftp    p@1@\`cat\ $HOME/.netrc\ \|\ \ awk\ \'\{\ print\ \$2\ \}\'\`@
  145.     else
  146.     set ftphosts=(ftp.uu.net prep.ai.mit.edu export.lcs.mit.edu \
  147.               labrea.stanford.edu sumex-aim.stanford.edu \
  148.               tut.cis.ohio-state.edu)
  149.     complete ftp     n/*/\$ftphosts/
  150.     endif
  151.  
  152.     complete rcp c/*:/f/ C@[./]*@f@ n/*/\$hosts/:
  153.  
  154.     complete dd c/if=/f/ c/of=/f/ \
  155.         c/conv=*,/"(ascii ebcdic ibm block unblock \
  156.                 lcase ucase swap noerror sync)"/,\
  157.         c/conv=/"(ascii ebcdic ibm block unblock \
  158.               lcase ucase swap noerror sync)"/,\
  159.             c/*=/x:'<number>'/ \
  160.         n/*/"(if of conv ibs obs bs cbs files skip file seek count)"/=
  161.  
  162.     complete emacs    c/-/"(batch d f funcall i insert kill l load \
  163.             no-init-file q t u user)"/ c/+/x:'<line_number>'/ \
  164.             n/-d/x:'<display>'/ n/-f/x:'<lisp_function>'/ n/-i/f/ \
  165.             n/-l/f:*.{el,elc}/ n/-t/x:'<terminal>'/ n/-u/u/ \
  166.             n/*/f:^*[\#~]/
  167.     complete mail       c/-/"(e i f n s u v)"/ c/*@/\$hosts/ \
  168.             n/-s/x:'<subject>'/ n/-u/u/ \
  169.             c@+@p:$HOME/Mail@ n/-f/f/ n/*/u/
  170.  
  171.     complete nslookup   p/1/x:'<host>'/ p/2/\$hosts/
  172.  
  173.     complete ar c/[dmpqrtx]/"(c l o u v a b i)"/ p/1/"(d m p q r t x)"// \
  174.         p/2/f:*.a/ p/*/f:*.o/
  175.  
  176.     complete {refile,sprev,snext,scan,pick,rmm,inc,folder,show} \
  177.         c@+@p:$HOME/Mail/@
  178.  
  179.     # More completions from waz@quahog.nusc.navy.mil (Tom Warzeka)
  180.  
  181.     complete users    p/1/x:'<accounting_file>'/
  182.     complete who    p/1/x:'<accounting_file>'/ n/am/"(i)"/ n/are/"(you)"/
  183.     complete ps            c/-t/x:'<tty>'/ c/-/"(a c C e g k l S t u v w x)"/ \
  184.             n/-k/x:'<kernel>'/ N/-k/x:'<core_file>'/ n/*/x:'<PID>'/
  185.  
  186.     complete chgrp    c/-/"(f R)"/ n/-*/x:'<group>'/ p/1/x:'<group>'/ n/*/f/
  187.     complete chown    c/-/"(f R)"/ n/-*/u/           p/1/u/           n/*/f/
  188.  
  189.     complete cat    c/-/"(b e n s t u v)"/ n/*/f/
  190.     complete mv        c/-/"(f i)"/ n/-*/f/ N/-*/d/ p/1/f/ p/2/d/ n/*/f/
  191.     complete cp        c/-/"(i p r)"/ n/-*r*/d/ n/-*/f/ N/-*/d/ \
  192.             p/1/f/ p/2/d/ n/*/f/
  193.  
  194.     complete ln        c/-/"(f s)"/ n/-*/f/ N/-*/x:'<link_name>'/ \
  195.             p/1/f/ p/2/x:'<link_name>'/
  196.  
  197.     complete tar     c/-[cru]*/"(b B C f F FF h i l m o p v w)"/ \
  198.             c/-[tx]*/"(   B C f F FF h i l m o p v w)"/ \
  199.             p/1/"(-c -r -t -u -x c r t u x)"/ \
  200.             c/-/"(b B C f F FF h i l m o p v w)"/ \
  201.             n/-c*f/x:'<new_tar_file or "-">'/ n/-*f/f:*.tar/ \
  202.             n/-[cru]*b/x:'<block_size>'/ n/-b/x:'<block_size>'/ \
  203.             n/-C/d/ N/-C/x:'<file or ".">'/ n/*/f/
  204.  
  205.     complete compress    c/-/"(c f v b)"/ n/-b/x:'<max_bits>'/ n/*/f:^*.Z/
  206.     complete uncompress    c/-/"(c f v)"/                        n/*/f:*.Z/
  207.  
  208.     complete man n@1@p:/usr/man/man1@     n@2@p:/usr/man/man2@ \
  209.          n@3@p:/usr/man/man3@     n@4@p:/usr/man/man4@ \
  210.          n@5@p:/usr/man/man5@     n@6@p:/usr/man/man6@ \
  211.          n@7@p:/usr/man/man7@     n@8@p:/usr/man/man8@ \
  212.          n@0@p:/usr/man/man0@     n@9@p:/usr/man/man9@ \
  213.              n@new@p:/usr/man/mann@   n@old@p:/usr/man/mano@ \
  214.              n@local@p:/usr/man/manl@ n@public@p:/usr/man/manp@ \
  215.          c/-/"(- f k P s t)"/ n/-f/c/ n/-k/x:'<keyword>'/ n/-P/d/ n/*/c/
  216.  
  217.     unset noglob
  218.     unset complete
  219. endif
  220.